package com.cu.employmentmanagementsystem.common.enums;

import lombok.Data;
import lombok.Getter;

/**
 * @author CaptainUniverse_
 * @date 2024/7/2
 */
@Getter
public enum UserRoleEnum
{
    STUDENT(0L, "student"),
    COMPANY(1L, "company"),
    ADMIN(2L, "admin");

    public final Long roleId;
    public final String role;

    UserRoleEnum(Long code, String role)
    {
        this.roleId = code;
        this.role = role;
    }


    public static String getRoleByCode(Long roleId)
    {
        for (UserRoleEnum userRoleEnum : UserRoleEnum.values())
        {
            if (userRoleEnum.getRoleId().equals(roleId))
            {
                return userRoleEnum.getRole();
            }
        }
        return null;
    }
}
